
	 
cd "`c(pwd)'"   // Set working directory to wherever the user placed "replication_package"

* Define global paths relative to the main directory
global main_dir "`c(pwd)'"
global data_dir "$main_dir/data_analysis"
global rawdata_dir "$main_dir/data_raw"
global tables_dir "$main_dir/tables"

* Load data
cd "$data_dir/"
use sample_od, clear
joinby gvkey year using crsp_compustat_1990_2020_clean, unmatched(master)
drop _merge
joinby gvkey year using od_density, unmatched(master)
drop _merge
joinby gvkey year using od_focal, unmatched(master)
drop _merge
joinby gvkey year using popod_density, unmatched(master)
drop _merge
joinby gvkey year using odn_connection, unmatched(master)
drop _merge
joinby gvkey year using codn_connection, unmatched(master)
drop _merge
joinby gvkey year using other_connection, unmatched(master)
drop _merge
joinby gvkey year using FluidityData, unmatched(master)
drop _merge
joinby gvkey year using totalsim4, unmatched(master)
drop _merge
joinby gvkey year using patents_filing, unmatched(master)
drop _merge
joinby gvkey year using avgCOWtn4, unmatched(master)
drop _merge
joinby gvkey year using avgISStreattn4, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin30, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin29, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin28, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin27, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin26, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin25, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin24, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin23, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin22, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin21, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin20, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin19, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin18, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin17, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin16, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin15, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin14, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin13, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin12, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin11, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin10, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin9, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin8, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin7, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin6, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin5, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin4, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin3, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin2, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin1, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin0, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_30, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_29, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_28, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_27, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_26, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_25, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_24, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_23, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_22, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_21, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_20, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_19, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_18, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_17, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_16, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_15, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_14, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_13, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_12, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_11, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_10, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_9, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_8, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_7, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_6, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_5, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_4, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_3, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_2, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin_1, unmatched(master)
drop _merge
joinby gvkey year using od_density_bin100, unmatched(master)
drop _merge
*******************************************************************************

save master1, replace
